package com.css.cloudlearn.consumerconsul.controller;

import com.css.cloudlearn.consumerconsul.controller.fegin.ProductorFegin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RequestMapping("/consumer-consul")
@RestController
public class controller {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private ProductorFegin feign;

    @RequestMapping("/ping")
    public String ping() {

//        String rest = restTemplate.getForObject("http://productor-consul/productor/ping", String.class);
//        System.out.println(rest);

        System.out.println(feign.ping());

        return feign.ping() + "consumer-consul pong";
    }
}
